#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "sph_vector.h"
#include "move_vector.h"
#include "simulation.h"

using namespace std;

int main () 
{
    string fileName = "test";
    
    vector<sph_vector> pos;
    pos.push_back(sph_vector(0,0));
    /*
    for(int i = 1; i < 3; i++)
    {
	    for(int j = 0; j < 2; j++)
	    {
		    pos.push_back(sph_vector(PI*i/(3),2*PI*j/(2)));
	    }
    */   
    

    
	simulation sim = simulation(pos);

	sim.run();
    
	pos = sim.get_pos();
	
	ofstream file;
	file.open(fileName.c_str());
	for(int i = 0; i < pos.size(); i++)
	{
		cout << pos[i].get_theta() << " --- " << pos[i].get_phi() << endl;
		file << pos[i].get_x() << " " << pos[i].get_y() << " " << pos[i].get_z() << endl;
	}
	
	double totalEnergy = 0;

	for(int i = 0; i < pos.size(); i++)
	{
		for(int j = i+1; j< pos.size(); j++)
		{
			totalEnergy += energy(pos[i],pos[j]);
		}
	}
	cout << -2*totalEnergy << endl;
}

